package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	// 定义URL和参数
	appid := "wxa75dedad2c041b7f"
	secret := "037cb6b0ed26310d209831a2c30c297e"
	url := fmt.Sprintf("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s", appid, secret)

	// 创建GET请求
	resp, err := http.Get(url)
	if err != nil {
		fmt.Println("Error creating request:", err)
		return
	}
	defer resp.Body.Close()

	// 读取响应
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("Error reading response:", err)
		return
	}

	// 打印响应
	fmt.Println("Response Status:", resp.Status)
	fmt.Println("Response Body:", string(body))

	//Response Status: 200 OK
	//Response Body: {
	//"access_token": "80_0vvhq6vBk-r0_d9Bp1TRbFB-Eei8j0SMN-qzbjaA7SYRu2NONgubKP8KvuGZ6DDQMcEGe2xh1axavUl-2iTKJRw9kuUHBJa2LuZAR-Sgep-KThHu77mpuYM2r0IQVAiAEALQV",
	//"expires_in":7200
	//}
	//
	//Process finished with exit code 0



}
